#coding=utf-8
import httplib2,urllib,httplib

#h = httplib2.Http();
#response,content=h.request("http://localhost:8080/springrestlet/restlet/example/");
#print response.status,content;

#params = urllib.urlencode({'spam': '哦的配送哦发帖', 'eggs': 2, 'bacon': 0})
#headers = {"Content-type": "application/x-www-form-urlencoded","Accept": "text/plain"}
#conn = httplib.HTTPConnection("localhost:8080")
#conn.request('POST',"/restlet/sysconstant/",params,headers)
#response = conn.getresponse()
#print response.status, response.reason
#conn.close();

#conn = httplib.HTTPConnection("localhost:8080")
#conn.request('PUT',"/restlet/sysconstant/8201/",params,headers)
#response = conn.getresponse()
#print response.status, response.reason
#conn.close();

#conn = httplib.HTTPConnection("localhost:8080")
#conn.request('DELETE',"/restlet/sysconstant/")
#response = conn.getresponse()
#print response.status, response.reason

http = httplib2.Http()

#delicious_user = 'odpsoft'
#delicious_pass = 'odpsoft'

#http.add_credentials(delicious_user, delicious_pass)

response, content = http.request('http://localhost:8080/restlet/sysconstants/DOC_TYPE/')

print response.status,content

#http.add_credentials(delicious_user, delicious_pass)

response, content = http.request('http://localhost:8080/restlet/sysconstant/8201/')

print response.status,content

response, content = http.request('http://localhost:8080/restlet/constantsearcher/?q=保险&start=1')

print response.status,content

#print content
#assert resp.status == 200
#assert resp['content-type'] == 'text/html; charset=utf-8'

#import httplib2
#import socks

#httplib2.debuglevel=4
#h = httplib2.Http(proxy_info = httplib2.ProxyInfo(socks.PROXY_TYPE_HTTP, 'localhost', 8000))
#r,c = h.request("http://bitworking.org/news/")

